package com.ai.core.framework.support;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
@Component
public class Cachemaneger {
     
 
	public void test() {
		System.out.println(acquire("1"));
		System.out.println(acquire("1"));
		System.out.println(acquire("1"));
	}
	
	@Cacheable(value = "testObject1", key = "#id") 
	public TestObject acquire(String id) {
	 
			return TestObject.get(id);
	 
	 
	}
	@CacheEvict (value = "testObject1", key = "#obj.id",beforeInvocation=true) 
	public void update(TestObject obj) {
		   throw new RuntimeException("1sedfdsfg");
	} 
 
 
	
	
}
